<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>快招</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="/public/js/mui/css/mui.min.css">
		<link rel="stylesheet" href="/public/weixin/css/css/index.css">
		<link rel="stylesheet" href="/public/weixin/css/iconfont/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="/public/js/mui/css/mui.picker.min.css" />
		<style>
			.mui-pull-top-tips {
				position: absolute;
				top: -20px;
				left: 50%;
				margin-left: -25px;
				width: 40px;
				height: 40px;
				border-radius: 100%;
				z-index: 1;
			}
			
			.mui-bar~.mui-pull-top-tips {
				top: 24px;
			}
			
			.mui-pull-top-wrapper {
				width: 42px;
				height: 42px;
				display: block;
				text-align: center;
				background-color: #efeff4;
				border: 1px solid #ddd;
				border-radius: 25px;
				background-clip: padding-box;
				box-shadow: 0 4px 10px #bbb;
				overflow: hidden;
			}
			
			.mui-pull-top-tips.mui-transitioning {
				-webkit-transition-duration: 200ms;
				transition-duration: 200ms;
			}
			
			.mui-pull-top-tips .mui-pull-loading {
				/*-webkit-backface-visibility: hidden;
                -webkit-transition-duration: 400ms;
                transition-duration: 400ms;*/
				margin: 0;
			}
			
			.mui-pull-top-wrapper .mui-icon,
			.mui-pull-top-wrapper .mui-spinner {
				margin-top: 7px;
			}
			
			.mui-pull-top-wrapper .mui-icon.mui-reverse {
				/*-webkit-transform: rotate(180deg) translateZ(0);*/
			}
			
			.mui-pull-bottom-tips {
				text-align: center;
				background-color: #efeff4;
				font-size: 15px;
				line-height: 40px;
				color: #777;
			}
			
			.mui-pull-top-canvas {
				overflow: hidden;
				background-color: #fafafa;
				border-radius: 40px;
				box-shadow: 0 4px 10px #bbb;
				width: 40px;
				height: 40px;
				margin: 0 auto;
			}
			
			.mui-pull-top-canvas canvas {
				width: 40px;
			}
			
			.mui-slider-indicator.mui-segmented-control {
				background-color: #efeff4;
			}
		</style>
	</head>

	<body>
		<input type="hidden" value="<?php echo ($now_is_apply_size); ?>" name="now_is_apply_size" id="now_is_apply_size">
		<input type="hidden" value="<?php echo ($is_apply_has_more); ?>" name="is_apply_has_more" id="is_apply_has_more">
		<input type="hidden" value="<?php echo ($now_no_apply_size); ?>" name="now_no_apply_size" id="now_no_apply_size">
		<input type="hidden" value="<?php echo ($no_apply_has_more); ?>" name="no_apply_has_more" id="no_apply_has_more">
		<input type="hidden" value="<?php echo ($now_quitJob_size); ?>" name="now_quitJob_size" id="now_quitJob_size">
		<input type="hidden" value="<?php echo ($quitJob_has_more); ?>" name="quitJob_has_more" id="quitJob_has_more">
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">我的员工</h1>
		</header>
		<div class="mui-content own_myworkmate">
			<div id="slider" class="mui-slider mui-fullscreen" style="top:50px;">
				<div id="sliderSegmentedControl" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted own_segement_control">
					<div class="mui-scroll">
						<a class="mui-control-item mui-active" href="#is_apply">
							已入职
						</a>
						<a class="mui-control-item" href="#no_apply">
							未入职
						</a>
						<a class="mui-control-item" href="#quitJob">
							已离职
						</a>
					</div>
				</div>
				
				<div class="mui-slider-group" style="top: 38px;">
				
					<div id="is_apply" class="mui-slider-item mui-control-content mui-active">
						<div id="scroll1" class="mui-scroll-wrapper">
							<div class="mui-scroll" id="is_apply_pull">
								<div class="own_myworkmate">
									<div class="own_timepicker">
										<button id='is_apply_date' class="btn own_timepicke_btn" pull_type="1">
											<span class="iconfont">
												&#xe7af;
											</span>
											<span id="is_apply_date_text">请选择日期</span>
										</button>
									</div>
								</div>
								<ul class="mui-table-view" id="is_apply_list">
									<?php if(is_array($list)): foreach($list as $key=>$item): ?><!--
	作者：zztongruilin@163.com
	时间：2016-12-24
	描述：入职渲染文件模版
-->
<li class="mui-table-view-cell">
	<div class="mui-slider-right mui-disabled">
		<a href="javascript:void(0);" onclick="tel('<?php echo ($item["mobile"]); ?>');" class="mui-btn mui-btn-ownprice mui-icon" style="font-size: 16px;">
			拨打电话
			<br/> <?php echo ($item["mobile"]); ?>
		</a>
	</div>
	<div class="mui-slider-handle">
		<div class="own_workmate_nt">
			<span class="own_workmate_name"><?php echo ($item["name"]); ?>&nbsp;&nbsp;&nbsp;&nbsp;
				<a href="javascript:void(0);" onclick="tel('<?php echo ($item["mobile"]); ?>');"><?php echo ($item["mobile"]); ?></a>
			</span>
			<span class="own_workmate_time">报名时间:<?php echo (date("Y-m-d",$item["created_time"])); ?></span>
		</div>
		<div class="own_workmate_com">
			<?php echo ($item["com_name"]); ?>
		</div>
	</div>
</li><?php endforeach; endif; ?>
								</ul>
							</div>
						</div>
					</div>
					
					<div id="no_apply" class="mui-slider-item mui-control-content">
						<div class="mui-scroll-wrapper">
							<div class="mui-scroll" id="no_apply_pull">
								<div class="own_myworkmate">
									<div class="own_timepicker">
										<button id='no_apply_date' class="btn own_timepicke_btn" pull_type="2">
											<span class="iconfont">
												&#xe7af;
											</span>
											<span id="no_apply_date_text">请选择日期</span>
										</button>
									</div>
								</div>
								<ul class="mui-table-view" id="no_apply_list">
									<?php if(is_array($no_applylist)): foreach($no_applylist as $key=>$item): ?><!--
	作者：zztongruilin@163.com
	时间：2016-12-24
	描述：入职渲染文件模版
-->
<li class="mui-table-view-cell">
	<div class="mui-slider-right mui-disabled">
		<a href="javascript:void(0);" onclick="tel('<?php echo ($item["mobile"]); ?>');" class="mui-btn mui-btn-ownprice mui-icon" style="font-size: 16px;">
			拨打电话
			<br/> <?php echo ($item["mobile"]); ?>
		</a>
	</div>
	<div class="mui-slider-handle">
		<div class="own_workmate_nt">
			<span class="own_workmate_name"><?php echo ($item["name"]); ?>&nbsp;&nbsp;&nbsp;&nbsp;
				<a href="javascript:void(0);" onclick="tel('<?php echo ($item["mobile"]); ?>');"><?php echo ($item["mobile"]); ?></a>
			</span>
			<span class="own_workmate_time">报名时间:<?php echo (date("Y-m-d",$item["created_time"])); ?></span>
		</div>
		<div class="own_workmate_com">
			<?php echo ($item["com_name"]); ?>
		</div>
	</div>
</li><?php endforeach; endif; ?>
								</ul>
							</div>
						</div>
					</div>
					
					<div id="quitJob" class="mui-slider-item mui-control-content ">
						<div id="scroll_quitJob" class="mui-scroll-wrapper">
							<div class="mui-scroll" id="quitJob_pull">
								<div class="own_myworkmate">
									<div class="own_timepicker">
										<button id='quitJob_date' class="btn own_timepicke_btn" pull_type="3">
											<span class="iconfont">
												&#xe7af;
											</span>
											<span id="quitJob_date_text">请选择日期</span>
										</button>
									</div>
								</div>
								<ul class="mui-table-view" id="quitJob_list">
								      <?php if(is_array($quitJobList)): foreach($quitJobList as $key=>$item): ?><!--
	作者：zztongruilin@163.com
	时间：2016-12-24
	描述：入职渲染文件模版
-->
<li class="mui-table-view-cell">
	<div class="mui-slider-right mui-disabled">
		<a href="javascript:void(0);" onclick="tel('<?php echo ($item["mobile"]); ?>');" class="mui-btn mui-btn-ownprice mui-icon" style="font-size: 16px;">
			拨打电话
			<br/> <?php echo ($item["mobile"]); ?>
		</a>
	</div>
	<div class="mui-slider-handle">
		<div class="own_workmate_nt">
			<span class="own_workmate_name"><?php echo ($item["name"]); ?>&nbsp;&nbsp;&nbsp;&nbsp;
				<a href="javascript:void(0);" onclick="tel('<?php echo ($item["mobile"]); ?>');"><?php echo ($item["mobile"]); ?></a>
			</span>
			<span class="own_workmate_time">报名时间:<?php echo (date("Y-m-d",$item["created_time"])); ?></span>
		</div>
		<div class="own_workmate_com">
			<?php echo ($item["com_name"]); ?>
		</div>
	</div>
</li><?php endforeach; endif; ?>
								</ul>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<script src="/public/js/mui/js/mui.js"></script>
		<script src="/public/js/mui/js/mui.pullToRefresh.js"></script>
		<script src="/public/js/mui/js/mui.pullToRefresh.material.js"></script>
		<script src="/public/js/mui/js/mui.picker.min.js"></script>
		<script src="/public/js/jquery-3.1.1.min.js"></script>
		<script>
			mui.init();
			//已入职的数据总数
			var now_is_apply_size = document.getElementById("now_is_apply_size").value;
			//已入职是否有更多数据
			var is_apply_has_more = parseInt(document.getElementById("is_apply_has_more").value);
			//已入职数据列表
			var $is_apply_list = $("#is_apply_list");
			//已入职日期按钮
			var $is_apply_date_text = $('#is_apply_date_text');
			//已入职选择的时间
			var is_apply_select_date = "";

			//现在年份
			var endyear = new Date().getFullYear();
			
			//未入职数据总数
			var now_no_apply_size = document.getElementById("now_no_apply_size").value;
			//未入职是否有更多数据
			var no_apply_has_more = parseInt(document.getElementById("no_apply_has_more").value);
			//未入职数据列表
			var $no_apply_list = $('#no_apply_list');
			//未来入职日期按钮
			var $no_apply_date_text = $("#no_apply_date_text");
			//未入职选择的时间
			var no_apply_select_date = "";
			
			//已离职数据总数
			var now_quitJob_size = document.getElementById("now_quitJob_size").value;
			//已离职是否有更多数据
			var quitJob_has_more = parseInt(document.getElementById("quitJob_has_more").value);
			//已离职数据列表
			var $quitJob_list = $('#quitJob_list');
			//已离职日期按钮
			var $quitJob_date_text = $("#quitJob_date_text");
			//已离职选择的时间
			var quitJob_select_date = "";
			
			(function($) {
				//阻尼系数
				var deceleration = mui.os.ios ? 0.003 : 0.0009;
				$('.mui-scroll-wrapper').scroll({
					bounce: false,
					indicators: true, //是否显示滚动条
					deceleration: deceleration
				});
				$.ready(function() {
					//循环初始化所有下拉刷新，上拉加载。
					$.each(document.querySelectorAll('.mui-slider-group .mui-scroll'), function(index, pullRefreshEl) {
						$(pullRefreshEl).pullToRefresh({
							up: {
								callback: function() {
									var self = this;
									var type = index + 1;
									switch(index) {
										case 0:
											if(!is_apply_has_more) {
												self.endPullUpToRefresh(true);
											}
											add_apply(is_apply_select_date,now_is_apply_size, type, $is_apply_list, function(b) {
												self.endPullUpToRefresh(b);
											});
											break;
										case 1:
											if(!no_apply_has_more) {
												self.endPullUpToRefresh(true);
											}
											add_apply(no_apply_select_date,now_no_apply_size, type, $no_apply_list, function(b) {
												self.endPullUpToRefresh(b);
											});
											break;
										case 2:
											if(!quitJob_has_more) {
												self.endPullUpToRefresh(true);
											}
											add_apply(quitJob_select_date,now_quitJob_size, type, $quitJob_list, function(b) {
												self.endPullUpToRefresh(b);
											});
											break;
									}
								}
							}
						});
					});
                    if(!is_apply_has_more) {
                        $('#is_apply_pull').pullToRefresh().endPullUpToRefresh(true);
                    }

                    if(!no_apply_has_more) {
                        $('#no_apply_pull').pullToRefresh().endPullUpToRefresh(true);
                    }
                    
                    if(!quitJob_has_more) {
                        $('#quitJob_pull').pullToRefresh().endPullUpToRefresh(true);
                    }
                    
					var add_apply = function(created_time,now_page_size, type, $list, callback) {
						var url = "<?php echo U('User/get_my_staff_list');?>" + '&now_page_size=' + now_page_size + "&type=" + type+ "&created_time=" + created_time;
						mui.ajax(url, {
							dataType: 'json',
							type: 'post',
							timeout: 0,
							headers: {
								'Content-Type': 'application/json'
							},
							success: function(data) {
								var content = data.content;
								if(type == 1) {
									now_is_apply_size = data.now_page_size;
								} else {
									now_no_apply_size = data.now_page_size;
								}
								$list.append(content);
								callback(!data.has_more);
							},
							error: function(xhr, type, errorThrown) {
								console.log(xhr);
								console.log(type);
								console.log(errorThrown);
							}
						});
					}
					document.getElementById("is_apply_date").addEventListener('tap', data_select);
					document.getElementById("no_apply_date").addEventListener('tap', data_select);
					document.getElementById("quitJob_date").addEventListener('tap', data_select);

					function data_select() {
						var type = this.getAttribute("pull_type");
						
						var options = {
							"type": "date",
							"beginYear": 2014,
							"endYear": endyear
						};
						var picker = new $.DtPicker(options);
						picker.show(function(rs) {
							if(type == 1){
								$is_apply_list.html("");
								$is_apply_date_text.text( rs.text);
								is_apply_select_date = rs.text;
								now_is_apply_size=0;
								$('#is_apply_pull').pullToRefresh().refresh(true);		
								$('#is_apply_pull').pullToRefresh().pullUpLoading();
							}else if(type ==2) {
								$no_apply_list.html("");
								$no_apply_date_text.text( rs.text);
								no_apply_select_date = rs.text;
								now_no_apply_size = 0;
								$('#no_apply_pull').pullToRefresh().refresh(true);		
								$('#no_apply_pull').pullToRefresh().pullUpLoading();
							}else{  /**离职列表**/
								$quitJob_list.html("");
								$quitJob_date_text.text( rs.text);
								quitJob_select_date = rs.text;
								now_quitJob_size = 0;
								$('#quitJob_pull').pullToRefresh().refresh(true);		
								$('#quitJob_pull').pullToRefresh().pullUpLoading();
							}
						});
					}
				});
			})(mui);
			
			function tel(mobile_phone){
				if(mui.os.plus){
					plus.device.dial(mobile_phone);
				}else{
					location.href = "tel://"+mobile_phone;
					//+"#mp.weixin.qq.com"
				}
			}
		</script>
	</body>

</html>